package com.ioc.initialmethod;

import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author cyt
 * @create 2020-07-30 下午 10:20
 */
@Component
public class Dog {

    /**
     * 1、指定初始化和销毁方法
     * 2、@PostConstruct、@PreDestroy
     *
     */
    public Dog() {
    }

    /**
     * 创建并赋值之后调用
     */
    @PostConstruct
    public void init() {
        System.out.println("Dog ... PostConstruct ");
    }

    /**
     * 销毁之后调用
     */
    @PreDestroy
    public void detory() {
        System.out.println("Dog ... PreDestroy");
    }
}
